package com.miyake.loveviewweb.server;

import org.slim3.datastore.Datastore;

import com.google.appengine.api.datastore.Key;
import com.miyake.loveviewweb.shared.model.HtmlModel;
import com.miyake.loveviewweb.shared.model.ReportModel;

public class ReportBuilder {
    private ReportModel reportModel;
    
    public ReportBuilder() {
        reportModel = new ReportModel();
    }
    
    public ReportBuilder(Key key) {
        reportModel = Datastore.get(ReportModel.class, key);
    }
    
    public void addHtml(String html) {
        HtmlModel htmlModel = new HtmlModel();
        htmlModel.setHtml(html);
        Datastore.put(htmlModel);
        reportModel.add(htmlModel.getKey());
    }
    
    public void addChart(Key key) {
        reportModel.add(key);
    }
    
    public ReportModel getReport() {
        return reportModel;
    }
}
